#include "NEventPublisher.h"

using namespace Engine;

RTTI_DEFINITIONS(NEventPublisher)

NEventPublisher::NEventPublisher()
	:mIsDeletedAfterPublishing(true),
	 mTimeEnqueued(0.0),
	 mDelay(0.0),
	 mSubscribers(NULL)
{
}

NEventPublisher::NEventPublisher(SubscriberList& subscriberList ,bool deleteAfterPublish, const double& wallTime, const double& delayTime)
	:mIsDeletedAfterPublishing(deleteAfterPublish),
	 mTimeEnqueued(wallTime),
	 mDelay(delayTime),
	 mSubscribers(&subscriberList)
{
}

NEventPublisher::~NEventPublisher()
{
}

void NEventPublisher::SetTime(const double& currentTime, const double& delay)
{
	mTimeEnqueued = currentTime;
	mDelay = delay;
}

double NEventPublisher::GetTimeEnqueued() const
{
	return mTimeEnqueued;
}

double NEventPublisher::GetDelay() const
{
	return mDelay;
}

bool NEventPublisher::IsExpired(const double& wallTime) const
{
	if(wallTime >= (mTimeEnqueued + mDelay))
	{
		return true;
	}
	return false;
}

bool NEventPublisher::IsDeletedAfterPublishing() const
{
	return mIsDeletedAfterPublishing;
}

void NEventPublisher::Deliver() const
{
}